const {app, pool} = require("./connect");

// 引入接口
const news = require("./routes/studyLog");
const project = require("./routes/studyProject");
app.use('/news',news);
app.use('/project',project);

// 开启监听
app.listen(8888, () => {
    console.log("node 基础服务启动成功:http://localhost:8888");
})

// 测试 mysql 连接
app.all('/testMysql', (req, res) => {
    console.log("用户尝试连接...");
    pool.getConnection((err, conn) => {
        if(err) throw err;
        res.json({message: 'mysql 连接成功!'});
        pool.releaseConnection(conn);
    })
})


